package com.mxpio.erp.common.hr.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Post;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_HR_EMPLOYEE_SALARY")
@Schema(description="员工薪资")
public class EmployeeSalary extends BaseEntity {

    @Id
    @Generator
    @Column(name = "ID_", updatable = false)
    @Schema(description = "ID")
    private String id;

    @Column(name = "EMPLOYEE_CODE_", length = 64)
    @Schema(description = "员工账号")
    private String employeeCode;

    @Column(name = "NAME_", length = 64)
    @Schema(description = "姓名")
    private String name;

    @Column(name = "YEAR_MONTH_", length = 64)
    @Schema(description = "年月")
    private String yearMonth;

    @Column(name = "POST_ID_")
    @Schema(description = "职位")
    @Dict(dicCode = "id", dicEntity = Post.class, dicText = "name")
    private String postId;

    @Column(name = "ENTRY_TIME_")
    @JsonFormat(pattern = "yyyy-MM-dd ", timezone = "GMT+8")
    @Schema(description = "入职时间")
    private Date entryTime;

    @Column(name = "PERFORMANCE_SCORE_")
    @Schema(description = "绩效（1分制）")
    private BigDecimal performanceScore;

    @Column(name = "PERFORMANCEBASED_PAY_")
    @Schema(description = "绩效工资额")
    private BigDecimal performancebasedPay;

    //基本工资
    @Column(name = "BASE_SALARY_")
    @Schema(description = "基本工资")//员工基本工资/当月工作日天数*出勤天数
    private BigDecimal baseSalary;

    //工龄补贴 入职年数*100
    @Column(name = "WORK_YEAR_SUBSIDY_")
    @Schema(description = "工龄补贴")
    private BigDecimal workYearSubsidy;

    @Column(name = "FULL_ATTENDANCE_SUBSIDY_")//全勤奖金 固定100，非全勤为0
    @Schema(description = "全勤")
    private BigDecimal fullAttendanceSubsidy;

    @Column(name = "POST_SUBSIDY_")
    @Schema(description = "岗位补贴")
    private BigDecimal postSubsidy;

    @Column(name = "PERFORMANCEBASED_SALARY_")//绩效工资=绩效工资额*绩效分数
    @Schema(description = "绩效工资")
    private BigDecimal performancebasedSalary;

    @Column(name = "MEAL_SUBSIDY_")
    @Schema(description = "餐补")
    private BigDecimal mealSubsidy;

    //住宿津贴
    @Column(name = "STAY_SUBSIDY_" )
    @Schema(description = "住宿津贴")
    private BigDecimal staySubsidy;

    @Column(name = "REWARD_OR_PUNISHMENT_" )
    @Schema(description = "奖惩(对应OA奖惩记录，有可能是负数)")
    private BigDecimal rewardOrPunishment;

    @Column(name = "ONE_POINT_FIVE_HOURS_PAY_")
    @Schema(description = "平时加班费(加班1.5倍)")
    private BigDecimal onePointFiveHoursPay;

    @Column(name = "DOUBLE_HOURS_PAY_")
    @Schema(description = "周末加班费（加班2倍时长）")
    private BigDecimal doubleHoursPay;

    @Column(name = "THRICE_HOURS_PAY_")
    @Schema(description = "节假日加班费(加班3倍时长)")
    private BigDecimal thriceHoursPay;


    //应发工资
    @Column(name = "SALARY_" )
    @Schema(description = "应发工资")
    private BigDecimal salary;


    @Column(name = "DETAIL_" ,columnDefinition = "TEXT" )
    @Schema(description = "计算明细")
    private String detail;

    @Dict(dicCode = "ERP_COMMON_YESNO")
    @Schema(description = "是否劳务")
    @Column(name = "IS_LABOR_", columnDefinition="varchar(64) default '0'")//0否 1是
    private String isLabor;

    @Column(name = "LABOR_HOUR_SALARY_" )
    @Schema(description = "劳务工时工资")
    private BigDecimal laborHourSalary;

    @Column(name = "LABOR_MANAGE_COST_" )
    @Schema(description = "劳务管理费用")
    private BigDecimal laborManageCost;

    @Dict(dicCode = "ERP_COMMON_YESNO")
    @Column(name = "HAS_CHECK_", columnDefinition="varchar(64) default '0'" ) //0 否 1是
    @Schema(description = "是否结账")
    private String hasFinish;

/*
    //代扣社保
    @Column(name = "SOCIAL_INSURANCE_" )
    @Schema(description = "代扣社保")
    private BigDecimal socialInsurance;

    //实发工资
    @Column(name = "ACTUAL_SALARY_" )
    @Schema(description = "实发工资")
    private BigDecimal actualSalary;
*/

}
